package com.sneakxy.mybatis.commons.repository;

import java.io.Serializable;
import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.repository.NoRepositoryBean;
import org.springframework.data.repository.Repository;

import com.sneakxy.mybatis.commons.repository.query.domain.Criteria;

/**
 * 标准查询
 * @author 潜行的青衣
 */
@NoRepositoryBean
public interface CriteriaRepository<T, ID extends Serializable> extends Repository<T, ID> {

	<S extends T> void update(S entity, Criteria<S> criteria);
	
	T findOne(Criteria<T> criteria);
	
	boolean exists(Criteria<T> criteria);
	
	void delete(Criteria<T> criteria);

	List<T> findAll(Criteria<T> criteria);

	Page<T> findAll(Criteria<T> criteria, Pageable pageable);

	List<T> findAll(Criteria<T> criteria, Sort sort);

	long count(Criteria<T> criteria);
	
}
